    
    public function {$actionName}($id)
    {
        // chequeo y obtengo el usuario loggeado
        $data['logueado'] = $this->getUsuarioLogueado();

        // valido permisos
        $gruposValidos = array();
        // ej. array('venta','logistica','contable','directivo');
        $this->validarPermisos($data['logueado'], $gruposValidos);

        // get object to edit
        $data['{$entity->singular}'] = new {$entity->singular|capitalize:true}($id);

        // Message Handler
        $data['msg'] = new PwMsgHandler();

        // prepare object attributes
        $this->updatePrepare($data);

        // if posting, try to save modifications
        if ($this->input->server('REQUEST_METHOD') === 'POST') {
            $this->{$actionName}_save($data);
        }

        // load view
        $this->smartyview->render('{$entity->singular}_{$actionName}.html', $data);

    } // function {$actionName}